package cn.mumzone.pos.util;

import android.os.CountDownTimer;

/**
 * Created by qiuzhenhuan on 2019/8/19.
 */

public class PayCountDownTimer extends CountDownTimer {


    boolean isRunning = false;

    private Object data;

    public PayCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
    }

    /**
     * Callback fired on regular interval.
     *
     * @param millisUntilFinished The amount of time until finished.
     */
    @Override
    public void onTick(long millisUntilFinished) {
        isRunning = true;
    }

    /**
     * Callback fired when the time is up.
     */
    @Override
    public void onFinish() {
        isRunning = false;
    }


    public void reset() {
        data = null;
    }


    public boolean isRunning() {
        return isRunning;
    }

    public void bindData(Object data){
        this.data = data;
    }

    public Object getData() {
        return data;
    }
}
